extends Area2D

signal hit

#当前代表的植物
var plant: String

# Called when the node enters the scene tree for the first time.
func _ready():
	#$AnimatedSprite2D.play()
	$CollisionShape2D.disabled=false
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	pass


func _on_body_entered(body):
	print("碰撞！")
	#僵尸变为吃的状态
	body.change_state()
	#hide()
	# 确保我们不会多次触发
	$CollisionShape2D.set_deferred("disabled", true)
	#碰到僵尸会被啃咬，然后死亡
	queue_free() #把自己删除
	pass # Replace with function body.

#设置植物
func set_plant(str):
	plant = str
	$AnimatedSprite2D.play(plant)
	pass
